package cn.com.taiji.oospub.wechat.entity;

import cn.com.taiji.entity.StringUUIDEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.github.dreamyoung.mprelation.EntityMapper;
import com.github.dreamyoung.mprelation.JoinColumn;
import com.github.dreamyoung.mprelation.ManyToOne;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author yzd
 * @since 2020-10-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CoursesOrders extends StringUUIDEntity implements Serializable {

    private static final long serialVersionUID = 1L;


    private String schoolId;

    private String memberId;

    private String orderCode;

    private LocalDateTime createTime;

    private Double amount;

    private String orderType;

    private CoursesOrderStatus status;

    private LocalDateTime payTime;

    private LocalDateTime printTime;

    private LocalDateTime bhTime;

    private LocalDateTime completedTime;

    private PayWay payWay;

    private String payMemberName;

    private String remark;

    private String isComment = "0";//未评价

    private String idDelete = "0";//未删除

    private String takeCode;//取餐号

    //取餐时间
    private LocalDateTime takeTime;

    private HasPrint hasprint;

    //自取方式,1到店自取,2.取餐柜,3.外卖
    private String takeMealType;
    //送餐地址id
    @TableField("receive_address_id")
    private String receiveAddressId;

    @TableField("meal_code")
    private String mealCode;

    @TableField("patient_number")
    private String patientNumber;


    @TableField(exist = false)
    @EntityMapper
    @ManyToOne
    @JoinColumn(name = "receive_address_id", referencedColumnName = "ID")
    private ReceiveAddress address;

    private String addressDetail;


    private String architecture;


    @TableField(exist = false)
    private List<CoursesOrdersDetails> detailList;

    @TableField(exist = false)
    private String totalPrice;

    @TableField(exist = false)
    private String mobile;

    @TableField(exist = false)
    private String statusStr;
    @TableField(exist = false)
    private String mealTimeName;
    @TableField(exist = false)
    private String customerNo;
    @TableField(exist = false)
    private String openId;
    @TableField(exist = false)
    private Double afterAmount;


    public enum PayWay {
        HTZ("现场支付/Cash") {},
        WX("微信/WeChat") {},
        CK("餐卡/Catering Card") {};

        private String value;

        private PayWay(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

    //0：未支付 1：已支付、2：备餐中、3：备餐完成、4：订单已完成:、5：交易失、 6：退款中、7：完成退款.
    public enum CoursesOrderStatus {
        WZF("未支付/No Paid") {},
        YZF("已支付/paid") {},
        BCZ("备餐中/Meal is ready") {},
        BCWC("备餐完成/Equipment eat finish") {},
        YYCS("营养测算/Nutrition calculation") {},
        DDYWC("订单完成/Order completed") {},
        JYSB("交易失败/Transaction failure") {},
        TKZ("退款中/Refunding") {},
        WCTK("完成退款/To complete a refund") {},
        CZ("储值/store amount") {};

        private String value;

        private CoursesOrderStatus(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

    }

    public enum HasPrint {
        YDY("已打印") {},
        WDY("未打印") {};

        private String value;

        private HasPrint(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

    }


}
